-- cleanup
USE master;
GO

IF DATABASEPROPERTYEX('Partitioning', 'Version') > 0
BEGIN
	ALTER DATABASE Partitioning SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
	DROP DATABASE Partitioning;
END

EXECUTE sys.sp_configure 'show advanced options', 1;
RECONFIGURE;
 
EXECUTE sys.sp_configure 'xp_cmdshell', 1;
RECONFIGURE;

EXECUTE sys.xp_cmdshell 'DEL/q C:\MSSQL\Backup\*.*';
GO

EXECUTE sys.sp_configure 'xp_cmdshell', 0;
RECONFIGURE;

EXECUTE sys.sp_configure 'show advanced options', 0;
RECONFIGURE;